<script setup>
import { RouterView } from "vue-router";
import { useSerialStore } from './stores/serialStore.js'
import { ref, onMounted } from "vue";
import { invoke } from "@tauri-apps/api/core";
import {Delete, User} from "@element-plus/icons-vue";    // When using the Tauri API npm package:

const { serialState } = useSerialStore();
serialState.instance.onDisconnect = () => {// 初始化全局事件监听
  serialState.isConnected = false;
};
window.addEventListener('beforeunload', async () => {// 页面关闭前自动断开
  if (serialState.isConnected) {
    await serialState.instance.disconnect()
  }
})
</script>

<template>
  <RouterView/>
</template>

<style scoped>
*{
  margin: 0;
  padding: 0;
}
</style>
